package udf.matching;


import java.io.IOException;


import org.apache.pig.EvalFunc;
import org.apache.pig.data.Tuple;
import org.apache.pig.data.TupleFactory;


import udf.string.CleanTag;


/**
 * Receives as input 
 * 
 * 
 * 
 * @author sergio
 *
 */
public class AnnotateTag extends EvalFunc<Tuple> {

	
	public Tuple exec(Tuple input) throws IOException {

		if (input.size() != 1 || input.get(0) == null) {
			return null;
		}

		else {
				
			
				String tag= (String) input.get(0);

				//Tuple output = TupleFactory.getInstance().newTuple(tags.size()+ line_size);
				Tuple output = TupleFactory.getInstance().newTuple();
				
				
				String clean= CleanTag.normalizeTag(tag);
				output.append(clean);
				return output;

		}

	}

}